import request from '@/utils/request.js'
// 首页获取频道文章接口封装
export const getArticles = (params) => request({
  method: 'GET',
  url: '/v1_1/articles',
  params
})

// 首页获取所有频道接口封装
export const getChannels = () => request({
  method: 'GET',
  url: '/v1_0/channels'
})
// 首页获取用户频道接口封装
export const getUserChannels = () => request({
  method: 'GET',
  url: '/v1_0/user/channels'
})
// 用户添加频道
export const addUserChannel = channel => {
  return request({
    method: 'PATCH',
    url: '/v1_0/user/channels',
    data: {
      channels: [channel]
    }
  })
}
// 用户删除频道
export const deleteUserChannel = channelId => {
  return request({
    method: 'DELETE',
    url: `/v1_0/user/channels/${channelId}`
  })
}
